import { useRequest } from '@h5app/sheep/hooks'
interface DictionaryResult {
  dicTypeId: number
  dataId: number
  dataVal: string
}

/** 获取字典 */
export const dictionaries = (
  dicTypeIdList: number[],
): Promise<ApiRequest.ResultDto<Record<number, DictionaryResult[]>>> => {
  const request = useRequest()
  return request({
    url: '/h5Web/dictionary/getMultipleDictionary',
    method: 'POST',
    data: { dicTypeIdList },
  })
}

/** 获取部门树形选择数据 */
export const DepartmentTreeData = (): Promise<ApiRequest.ResultDto<ApiRequest.RegionResult[]>> => {
  const request = useRequest()
  return request({
    url: '/h5Web/department/getTreeSelection',
    method: 'POST',
    data: {},
  })
}
